package com.ruoyi.ly.mapper;

import java.util.List;

import com.github.pagehelper.Page;
import com.ruoyi.ly.domain.ServeExaminePlan;
import com.ruoyi.ly.domain.dto.PageServeUserDTO;
import com.ruoyi.ly.domain.vo.PageProjectVO;
import com.ruoyi.ly.domain.vo.ServeFlowAPPVO;
import com.ruoyi.ly.domain.vo.ServePlanAPPVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * 巡检计划Mapper接口
 * 
 * @author wj
 * @date 2024-01-13
 */
@Mapper
public interface ServeExaminePlanMapper 
{
    /**
     * 查询巡检计划
     * 
     * @param examinePlanId 巡检计划主键
     * @return 巡检计划
     */
    public ServeExaminePlan selectServeExaminePlanByExaminePlanId(Long examinePlanId);

    /**
     * 查询巡检计划列表
     * 
     * @param serveExaminePlan 巡检计划
     * @return 巡检计划集合
     */
    public List<ServeExaminePlan> selectServeExaminePlanList(ServeExaminePlan serveExaminePlan);

    /**
     * 新增巡检计划
     * 
     * @param serveExaminePlan 巡检计划
     * @return 结果
     */
    public int insertServeExaminePlan(ServeExaminePlan serveExaminePlan);

    /**
     * 修改巡检计划
     * 
     * @param serveExaminePlan 巡检计划
     * @return 结果
     */
    public int updateServeExaminePlan(ServeExaminePlan serveExaminePlan);

    /**
     * 删除巡检计划
     * 
     * @param examinePlanId 巡检计划主键
     * @return 结果
     */
    public int deleteServeExaminePlanByExaminePlanId(Long examinePlanId);

    /**
     * 批量删除巡检计划
     * 
     * @param examinePlanIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteServeExaminePlanByExaminePlanIds(Long[] examinePlanIds);




    //根据巡检计划id显示对应的巡检计划信息(小程序端)   keyId 用于区分待巡检和已巡检
    List<ServeFlowAPPVO> selectByPlanId(@Param("examinePlanId") Long examinePlanId,@Param("keyId") Long keyId);

    //查询所有的计划
    @Select("select * from serve_examine_plan")
    List<ServeExaminePlan> selectAll();

    //修改巡检人
    @Update("update serve_examine_plan set examine_allow_user_ids=#{openId} where examine_plan_id=#{examinePlanId}")
    void update(@Param("openId")String openId,@Param("examinePlanId")Long examinePlanId);
}
